package com.senven.role.controller;

import com.senven.common.entity.Role;
import com.senven.common.vo.CommonResult;
import com.senven.role.service.RoleSerive;
import com.senven.role.vo.RoleVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/role")
@Api(tags = "role传给前端的接口")
public class RoleController {
    @Autowired
    private RoleSerive roleSerive;
    @PostMapping(value = "/findInfo")
    public CommonResult findInfo(Integer currentPage,Integer pageSize, @RequestBody Role role){
        return roleSerive.findInfo(currentPage,pageSize,role);
    }



    @PostMapping("findRole")
    @ApiOperation(value = "查询接口")
    public CommonResult findRole(Integer currentPage,Integer pageSize, @RequestBody RoleVo roleVo){
        return roleSerive.selectRole(currentPage,pageSize,roleVo);
    }


    @PostMapping("insert")
    @ApiOperation(value = "添加接口")
    public CommonResult insert(@RequestBody Role role){
       return roleSerive.insert(role);
    }

    @PostMapping("delete")
    @ApiOperation(value = "删除接口")
    public CommonResult delete(Integer roleid){
       return roleSerive.delete(roleid);
    }

    @PostMapping("update")
    @ApiOperation(value = "查询接口")
    public CommonResult update(@RequestBody Role roleid){
        return roleSerive.update(roleid);
    }


}
